package org.book.common.conf;

import org.book.interceptor.LoginInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by weican on 2017/7/14.
 */
public class WebAppConfiguration extends WebMvcConfigurerAdapter {
    /**
     * 需要拦截的 url
     */
    String[] inexcludes = {"/*"};

    /**
     * 不需要拦截的 url
     */
    String[] excludes = {"/login"};

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns(inexcludes).excludePathPatterns(excludes);
    }
}
